package com.neusoft.mapper;

import com.neusoft.domain.Orders;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrdersDao {
    @Insert("INSERT INTO orders(userId, businessId, orderDate, orderTotal, daId, orderState) " +
            "VALUES(#{userId},#{businessId},#{orderDate},#{orderTotal},#{daId},#{orderState})")
    @Options(useGeneratedKeys = true,keyProperty = "orderId")
    int createOrders(Orders orders);
    @Select("SELECT * FROM orders WHERE orderId = #{orderId}")
    Orders getOrdersById(Integer orderId);

    @Select("select * from orders where userId = #{userId}")
    List<Orders> listOrdersByUserId(String userId);
}
